{% set current_ver = versions.0 %}
{% set new_ver = versions.1 %}
{% set current_ver_without_dots = versions.2 %}
{% set new_ver_without_dots = versions.3 %}
<tr class="odd">
    <td class="padding10 first-collumn">
        Roxy-WI
    </td>
    <td>
        <b
                {% if new_ver_without_dots > current_ver_without_dots and new_ver != "Sorry cannot get current version" %}
                title="There is a newer version Roxy-WI"
                style="color: var(--red-color)"
                {% else %}
                title="There is not a newer version Roxy-WI"
                style="color: var(--green-color)"
                {% endif %}
        >
            {{current_ver}}
        </b>
    </td>
    <td class="padding10">
        <b>{{new_ver}}</b>
    </td>
    <td>
        {% if new_ver_without_dots > current_ver_without_dots and new_ver != "Sorry cannot get current version" %}
        <a class="ui-button ui-widget ui-corner-all" onclick="updateService('roxy-wi')" title="Update Roxy-WI">Update</a>
        {% endif %}
    </td>
    <td>
        The main application
    </td>
    <td></td>
</tr>
{% for s in services %}
    {% if s.0 == 'roxy-wi-smon' or s.0 == 'roxy-wi-checker' or s.0 == 'roxy-wi-keep_alive' or s.0 == 'roxy-wi-metrics' or s.0 == 'roxy-wi-portscanner' %}
<tr class="{{ loop.cycle('even', 'odd') }}">
    {% set is_need_update = 0 %}
    {% if s.0 == 'roxy-wi-smon' %}
        {% set service_name = 'SMON' %}
        {% set service_link = 'smon' %}
        {% set desc_link = 'https://roxy-wi.org/services.py?service=smon' %}
    {% if s.3|float < smon_ver|float %}
        {% set is_need_update = 1 %}
    {% endif %}
{% elif s.0 == 'roxy-wi-checker' %}
    {% set service_name = 'Checker' %}
    {% set service_link = 'checker' %}
    {% set desc_link = 'https://roxy-wi.org/services.py?service=checker' %}
    {% if s.3|float < checker_ver|float %}
        {% set is_need_update = 1 %}
    {% endif %}
{% elif s.0 == 'roxy-wi-keep_alive' %}
    {% set service_name = 'Auto start' %}
    {% set service_link = 'auto_start' %}
    {% set desc_link = 'https://roxy-wi.org/services.py?service=auto_start' %}
    {% if s.3|float < keep_ver|float %}
        {% set is_need_update = 1 %}
    {% endif %}
{% elif s.0 == 'roxy-wi-metrics' %}
    {% set service_name = 'Metrics' %}
    {% set service_link = 'metrics' %}
    {% set desc_link = 'https://roxy-wi.org/services.py?service=metrics' %}
    {% if s.3|float < metrics_ver|float %}
        {% set is_need_update = 1 %}
    {% endif %}
{% elif s.0 == 'roxy-wi-portscanner' %}
    {% set service_name = 'Port scanner' %}
    {% set service_link = 'portscanner' %}
    {% set desc_link = 'https://roxy-wi.org/services.py?service={{service_link}}' %}
    {% if s.3|float < portscanner_ver|float %}
        {% set is_need_update = 1 %}
    {% endif %}
{% endif %}
    <td class="padding10 first-collumn">
        {{service_name}}
    </td>
    <td>
        {% if s.3 != '* is not installed' %}
        <b
                {% if is_need_update %}
                title="There is a newer version {{service_name}}"
                style="color: var(--red-color)"
                {% else %}
                title="There is not a newer version {{service_name}}"
                style="color: var(--green-color)"
                {% endif %}
        >
            {{s.3}}
        </b>
        {% endif %}
    </td>
    <td class="padding10">
        <b>
            {% if s.0 == 'roxy-wi-smon' %}
                {{smon_ver}}
            {% elif s.0 == 'roxy-wi-checker' %}
                {{checker_ver}}
            {% elif s.0 == 'roxy-wi-keep_alive' %}
                {{keep_ver}}
            {% elif s.0 == 'roxy-wi-metrics' %}
                {{metrics_ver}}
            {% elif s.0 == 'roxy-wi-portscanner' %}
                {{portscanner_ver}}
            {% endif %}
        </b>
    </td>
    <td>
        {% if s.3 != '* is not installed' %}
            {% if is_need_update %}
                <a class="ui-button ui-widget ui-corner-all" onclick="updateService('{{s.0}}')" title="Update {{service_name}}">Update</a>
            {% endif %}
        {% else %}
            {{service_name}} service is not installed
            <a href="https://roxy-wi.org/services.py?service={{service_link}}#installation" title="{{service_name}} installation" target="_blank" class="link">Read about installation</a>
        {% endif %}
    </td>
    <td>
        Read more about <a href="{{desc_link}}" title="Read more about {{service_name}}" target="_blank" class="link">{{service_name}}</a>
    </td>
    <td></td>
</tr>
{% endif %}
{% endfor %}